home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / nt / emacssrc.zip / EMACSSRC.TAR / emacs-19.17 / src / dired.c < prev    next >
C/C++ Source or Header  |  1993-12-09  |  20KB  |  663 lines

  1. /* Lisp functions for making directory listings.
  2.    Copyright (C) 1985, 1986, 1993 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU Emacs.
  5.  
  6. GNU Emacs is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 1, or (at your option)
  9. any later version.
  10.  
  11. GNU Emacs is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU Emacs; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20.  
  21. #include <stdio.h>
  22. #include <sys/types.h>
  23. #include <sys/stat.h>
  24.  
  25. #include "config.h"
  26.  
  27. #ifdef WINDOWSNT
  28. #include <windows.h>
  29. #endif /* WINDOWS_NT */
  30.  
  31. #ifdef VMS
  32. #include <string.h>
  33. #include <rms.h>
  34. #include <rmsdef.h>
  35. #endif
  36.  
  37. /* The d_nameln member of a struct dirent includes the '\0' character
  38.    on some systems, but not on others.  What's worse, you can't tell
  39.    at compile-time which one it will be, since it really depends on
  40.    the sort of system providing the filesystem you're reading from,
  41.    not the system you are running on.  Paul Eggert
  42.    <eggert@bi.twinsun.com> says this occurs when Emacs is running on a
  43.    SunOS 4.1.2 host, reading a directory that is remote-mounted from a
  44.    Solaris 2.1 host and is in a native Solaris 2.1 filesystem.
  45.  
  46.    Since applying strlen to the name always works, we'll just do that.  */
  47. #define NAMLEN(p) strlen (p->d_name)
  48.  
  49. #ifdef SYSV_SYSTEM_DIR
  50.  
  51. #include <dirent.h>
  52. #define DIRENTRY struct dirent
  53.  
  54. #else
  55.  
  56. #ifdef NONSYSTEM_DIR_LIBRARY
  57. #include "ndir.h"
  58. #else /* not NONSYSTEM_DIR_LIBRARY */
  59. #include <sys/dir.h>
  60. #endif /* not NONSYSTEM_DIR_LIBRARY */
  61.  
  62. #define DIRENTRY struct direct
  63.  
  64. #endif
  65.  
  66. #include "lisp.h"
  67. #include "buffer.h"
  68. #include "commands.h"
  69.  
  70. #include "regex.h"
  71.  
  72. #include "dired_p.h"
  73. #include "search_d.h"
  74. #include "alloca_p.h"
  75. #include "filemode_p.h"
  76. static int file_name_completion_stat _P_((Lisp_Object dirname, DIRENTRY *dp,
  77.                                           struct stat *st_addr));
  78.  
  79. /* A search buffer, with a fastmap allocated and ready to go.  */
  80. extern struct re_pattern_buffer searchbuf;
  81.  
  82. #define min(a, b) ((a) < (b) ? (a) : (b))
  83.  
  84. /* if system does not have symbolic links, it does not have lstat.
  85.    In that case, use ordinary stat instead.  */
  86.  
  87. #ifndef S_IFLNK
  88. #define lstat stat
  89. #endif
  90.  
  91. Lisp_Object Vcompletion_ignored_extensions;
  92.  
  93. Lisp_Object Qcompletion_ignore_case;
  94.  
  95. Lisp_Object Qdirectory_files;
  96. Lisp_Object Qfile_name_completion;
  97. Lisp_Object Qfile_name_all_completions;
  98. Lisp_Object Qfile_attributes;
  99.  
  100. DEFUN ("directory-files", Fdirectory_files, Sdirectory_files, 1, 4, 0,
  101.   "Return a list of names of files in DIRECTORY.\n\
  102. There are three optional arguments:\n\
  103. If FULL is non-nil, absolute pathnames of the files are returned.\n\
  104. If MATCH is non-nil, only pathnames containing that regexp are returned.\n\
  105. If NOSORT is non-nil, the list is not sorted--its order is unpredictable.\n\
  106.  NOSORT is useful if you plan to sort the result yourself.")
  107.   (dirname, full, match, nosort)
  108.      Lisp_Object dirname, full, match, nosort;
  109. {
  110.   DIR *d;
  111.   int length;
  112.   Lisp_Object list, name, dirfilename;
  113.   Lisp_Object handler;
  114.  
  115.   /* If the file name has special constructs in it,
  116.      call the corresponding file handler.  */
  117.   handler = Ffind_file_name_handler (dirname);
  118.   if (!NILP (handler))
  119.     {
  120.       Lisp_Object args[6];
  121.  
  122.       args[0] = handler;
  123.       args[1] = Qdirectory_files;
  124.       args[2] = dirname;
  125.       args[3] = full;
  126.       args[4] = match;
  127.       args[5] = nosort;
  128.       return Ffuncall (6, args);
  129.     }
  130.  
  131.   {
  132.     struct gcpro gcpro1, gcpro2;
  133.  
  134.     /* Because of file name handlers, these functions might call
  135.      Ffuncall, and cause a GC.  */
  136.     GCPRO1 (match);
  137.     dirname = Fexpand_file_name (dirname, Qnil);
  138.     UNGCPRO;
  139.     GCPRO2 (match, dirname);
  140.     dirfilename = Fdirectory_file_name (dirname);
  141.     UNGCPRO;
  142.   }
  143.  
  144.   if (!NILP (match))
  145.     {
  146.       CHECK_STRING (match, 3);
  147.  
  148.       /* MATCH might be a flawed regular expression.  Rather than
  149.      catching and signalling our own errors, we just call
  150.      compile_pattern to do the work for us.  */
  151. #ifdef VMS
  152.       compile_pattern (match, &searchbuf, 0,
  153.                buffer_defaults.downcase_table->contents);
  154. #else
  155.       compile_pattern (match, &searchbuf, 0, 0);
  156. #endif
  157.     }
  158.  
  159.   /* Now searchbuf is the compiled form of MATCH; don't call anything
  160.      which might compile a new regexp until we're done with the loop!  */
  161.  
  162.   /* Do this opendir after anything which might signal an error; if
  163.      an error is signalled while the directory stream is open, we
  164.      have to make sure it gets closed, and setting up an
  165.      unwind_protect to do so would be a pain.  */
  166.   d = opendir (XSTRING (dirfilename)->data);
  167.   if (! d)
  168.     report_file_error ("Opening directory", Fcons (dirname, Qnil));
  169.  
  170.   list = Qnil;
  171.   length = XSTRING (dirname)->size;
  172.  
  173.   /* Loop reading blocks */
  174.   while (1)
  175.     {
  176.       DIRENTRY *dp = readdir (d);
  177.       int len;
  178.  
  179.       if (!dp) break;
  180.       len = NAMLEN (dp);
  181.       if (dp->d_ino)
  182.     {
  183.       if (NILP (match)
  184.           || (0 <= re_search (&searchbuf, dp->d_name, len, 0, len, 0)))
  185.         {
  186.           if (!NILP (full))
  187.         {
  188.           int index = XSTRING (dirname)->size;
  189.           int total = len + index;
  190. #ifndef VMS
  191.           if (length == 0 ||
  192.               !IS_ANY_SEPARATOR(XSTRING (dirname)->data[length - 1]))
  193.             total++;
  194. #endif /* VMS */
  195.  
  196.           name = make_uninit_string (total);
  197.           bcopy (XSTRING (dirname)->data, XSTRING (name)->data,
  198.              index);
  199. #ifndef VMS
  200.           if (length == 0 ||
  201.               !IS_ANY_SEPARATOR(XSTRING (dirname)->data[length - 1]))
  202.             XSTRING (name)->data[index++] = PATH_SEPARATOR;
  203. #endif /* VMS */
  204.           bcopy (dp->d_name, XSTRING (name)->data + index, len);
  205.         }
  206.           else
  207.         name = make_string (dp->d_name, len);
  208.           list = Fcons (name, list);
  209.         }
  210.     }
  211.     }
  212.   closedir (d);
  213.   if (!NILP (nosort))
  214.     return list;
  215.   return Fsort (Fnreverse (list), Qstring_lessp);
  216. }
  217.  
  218.  
  219. DEFUN ("file-name-completion", Ffile_name_completion, Sfile_name_completion,
  220.   2, 2, 0,
  221.   "Complete file name FILE in directory DIR.\n\
  222. Returns the longest string\n\
  223. common to all filenames in DIR that start with FILE.\n\
  224. If there is only one and FILE matches it exactly, returns t.\n\
  225. Returns nil if DIR contains no name starting with FILE.")
  226.   (file, dirname)
  227.      Lisp_Object file, dirname;
  228. {
  229.   Lisp_Object handler;
  230.   /* Don't waste time trying to complete a null string.
  231.      Besides, this case happens when user is being asked for
  232.      a directory name and has supplied one ending in a /.
  233.      We would not want to add anything in that case
  234.      even if there are some unique characters in that directory.  */
  235.   if (XTYPE (file) == Lisp_String && XSTRING (file)->size == 0)
  236.     return file;
  237.  
  238.   /* If the file name has special constructs in it,
  239.      call the corresponding file handler.  */
  240.   handler = Ffind_file_name_handler (dirname);
  241.   if (!NILP (handler))
  242.     return call3 (handler, Qfile_name_completion, file, dirname);
  243.  
  244.   return file_name_completion (file, dirname, 0, 0);
  245. }
  246.  
  247. DEFUN ("file-name-all-completions", Ffile_name_all_completions,
  248.   Sfile_name_all_completions, 2, 2, 0,
  249.   "Return a list of all completions of file name FILE in directory DIR.\n\
  250. These are all file names in directory DIR which begin with FILE.")
  251.   (file, dirname)
  252.      Lisp_Object file, dirname;
  253. {
  254.   Lisp_Object handler;
  255.  
  256.   /* If the file name has special constructs in it,
  257.      call the corresponding file handler.  */
  258.   handler = Ffind_file_name_handler (dirname);
  259.   if (!NILP (handler))
  260.     return call3 (handler, Qfile_name_all_completions, file, dirname);
  261.  
  262.   return file_name_completion (file, dirname, 1, 0);
  263. }
  264.  
  265. Lisp_Object
  266. file_name_completion (file, dirname, all_flag, ver_flag)
  267.      Lisp_Object file, dirname;
  268.      int all_flag, ver_flag;
  269. {
  270.   DIR *d;
  271.   int bestmatchsize, skip;
  272.   register int compare, matchsize;
  273.   unsigned char *p1, *p2;
  274.   int matchcount = 0;
  275.   Lisp_Object bestmatch, tem, elt, name;
  276.   struct stat st;
  277.   int directoryp;
  278.   int passcount;
  279.   int count = specpdl_ptr - specpdl;
  280. #ifdef VMS
  281.   extern DIRENTRY * readdirver ();
  282.  
  283.   DIRENTRY *((* readfunc) ());
  284.  
  285.   /* Filename completion on VMS ignores case, since VMS filesys does.  */
  286.   specbind (Qcompletion_ignore_case, Qt);
  287.  
  288.   readfunc = readdir;
  289.   if (ver_flag)
  290.     readfunc = readdirver;
  291.   file = Fupcase (file);
  292. #else  /* not VMS */
  293.   CHECK_STRING (file, 0);
  294. #endif /* not VMS */
  295.  
  296.   dirname = Fexpand_file_name (dirname, Qnil);
  297.   bestmatch = Qnil;
  298.  
  299.   /* With passcount = 0, ignore files that end in an ignored extension.
  300.      If nothing found then try again with passcount = 1, don't ignore them.
  301.      If looking for all completions, start with passcount = 1,
  302.      so always take even the ignored ones.
  303.  
  304.      ** It would not actually be helpful to the user to ignore any possible
  305.      completions when making a list of them.**  */
  306.  
  307.   for (passcount = !!all_flag; NILP (bestmatch) && passcount < 2; passcount++)
  308.     {
  309.       if (!(d = opendir (XSTRING (Fdirectory_file_name (dirname))->data)))
  310.     report_file_error ("Opening directory", Fcons (dirname, Qnil));
  311.  
  312.       /* Loop reading blocks */
  313.       /* (att3b compiler bug requires do a null comparison this way) */
  314.       while (1)
  315.     {
  316.       DIRENTRY *dp;
  317.       int len;
  318.  
  319. #ifdef VMS
  320.       dp = (*readfunc) (d);
  321. #else
  322.       dp = readdir (d);
  323. #endif
  324.       if (!dp) break;
  325.  
  326.       len = NAMLEN (dp);
  327.  
  328.       if (!NILP (Vquit_flag) && NILP (Vinhibit_quit))
  329.         goto quit;
  330.       if (!dp->d_ino
  331.           || len < XSTRING (file)->size
  332.           || 0 <= scmp (dp->d_name, XSTRING (file)->data,
  333.                 XSTRING (file)->size))
  334.         continue;
  335.  
  336.           if (file_name_completion_stat (dirname, dp, &st) < 0)
  337.             continue;
  338.  
  339.           directoryp = ((st.st_mode & S_IFMT) == S_IFDIR);
  340.       tem = Qnil;
  341.           if (!directoryp)
  342.             {
  343.           /* Compare extensions-to-be-ignored against end of this file name */
  344.           /* if name is not an exact match against specified string */
  345.           if (!passcount && len > XSTRING (file)->size)
  346.         /* and exit this for loop if a match is found */
  347.         for (tem = Vcompletion_ignored_extensions;
  348.              CONSP (tem); tem = XCONS (tem)->cdr)
  349.           {
  350.             elt = XCONS (tem)->car;
  351.             if (XTYPE (elt) != Lisp_String) continue;
  352.             skip = len - XSTRING (elt)->size;
  353.             if (skip < 0) continue;
  354.  
  355.             if (0 <= scmp (dp->d_name + skip,
  356.                    XSTRING (elt)->data,
  357.                    XSTRING (elt)->size))
  358.               continue;
  359.             break;
  360.           }
  361.         }
  362.  
  363.       /* Unless an ignored-extensions match was found,
  364.              process this name as a completion */
  365.       if (passcount || !CONSP (tem))
  366.         {
  367.           /* Update computation of how much all possible completions match */
  368.  
  369.           matchcount++;
  370.  
  371.           if (all_flag || NILP (bestmatch))
  372.         {
  373.           /* This is a possible completion */
  374.           if (directoryp)
  375.             {
  376.               /* This completion is a directory; make it end with '/' */
  377.               name = Ffile_name_as_directory (make_string (dp->d_name, len));
  378.             }
  379.           else
  380.             name = make_string (dp->d_name, len);
  381.           if (all_flag)
  382.             {
  383.               bestmatch = Fcons (name, bestmatch);
  384.             }
  385.           else
  386.             {
  387.               bestmatch = name;
  388.               bestmatchsize = XSTRING (name)->size;
  389.             }
  390.         }
  391.           else
  392.         {
  393.           compare = min (bestmatchsize, len);
  394.           p1 = XSTRING (bestmatch)->data;
  395.           p2 = (unsigned char *) dp->d_name;
  396.           matchsize = scmp(p1, p2, compare);
  397.           if (matchsize < 0)
  398.             matchsize = compare;
  399.           /* If this dirname all matches,
  400.              see if implicit following slash does too.  */
  401.           if (directoryp
  402.               && compare == matchsize
  403.               && bestmatchsize > matchsize
  404.               && IS_ANY_SEPARATOR(p1[matchsize]))
  405.             matchsize++;
  406.           bestmatchsize = min (matchsize, bestmatchsize);
  407.         }
  408.         }
  409.     }
  410.       closedir (d);
  411.     }
  412.  
  413.   unbind_to (count, Qnil);
  414.  
  415.   if (all_flag || NILP (bestmatch))
  416.     return bestmatch;
  417.   if (matchcount == 1 && bestmatchsize == XSTRING (file)->size)
  418.     return Qt;
  419.   return Fsubstring (bestmatch, make_number (0), make_number (bestmatchsize));
  420.  quit:
  421.   if (d) closedir (d);
  422.   Vquit_flag = Qnil;
  423.   return Fsignal (Qquit, Qnil);
  424. }
  425.  
  426. static int
  427. file_name_completion_stat (dirname, dp, st_addr)
  428.      Lisp_Object dirname;
  429.      DIRENTRY *dp;
  430.      struct stat *st_addr;
  431. {
  432.   int len = NAMLEN (dp);
  433.   int pos = XSTRING (dirname)->size;
  434.   char *fullname = (char *) alloca (len + pos + 2);
  435.  
  436.   bcopy (XSTRING (dirname)->data, fullname, pos);
  437. #ifndef VMS
  438.   if (!IS_ANY_SEPARATOR(fullname[pos - 1]))
  439.     fullname[pos++] = PATH_SEPARATOR;
  440. #endif
  441.  
  442.   bcopy (dp->d_name, fullname + pos, len);
  443.   fullname[pos + len] = 0;
  444.  
  445.   return stat (fullname, st_addr);
  446. }
  447.  
  448. #ifdef VMS
  449.  
  450. DEFUN ("file-name-all-versions", Ffile_name_all_versions,
  451.   Sfile_name_all_versions, 2, 2, 0,
  452.   "Return a list of all versions of file name FILE in directory DIR.")
  453.   (file, dirname)
  454.      Lisp_Object file, dirname;
  455. {
  456.   return file_name_completion (file, dirname, 1, 1);
  457. }
  458.  
  459. DEFUN ("file-version-limit", Ffile_version_limit, Sfile_version_limit, 1, 1, 0,
  460.   "Return the maximum number of versions allowed for FILE.\n\
  461. Returns nil if the file cannot be opened or if there is no version limit.")
  462.   (filename)
  463.      Lisp_Object filename;
  464. {
  465.   Lisp_Object retval;
  466.   struct FAB    fab;
  467.   struct RAB    rab;
  468.   struct XABFHC xabfhc;
  469.   int status;
  470.  
  471.   filename = Fexpand_file_name (filename, Qnil);
  472.   fab      = cc$rms_fab;
  473.   xabfhc   = cc$rms_xabfhc;
  474.   fab.fab$l_fna = XSTRING (filename)->data;
  475.   fab.fab$b_fns = strlen (fab.fab$l_fna);
  476.   fab.fab$l_xab = (char *) &xabfhc;
  477.   status = sys$open (&fab, 0, 0);
  478.   if (status != RMS$_NORMAL)    /* Probably non-existent file */
  479.     return Qnil;
  480.   sys$close (&fab, 0, 0);
  481.   if (xabfhc.xab$w_verlimit == 32767)
  482.     return Qnil;        /* No version limit */
  483.   else
  484.     return make_number (xabfhc.xab$w_verlimit);
  485. }
  486.  
  487. #endif /* VMS */
  488.  
  489. Lisp_Object
  490. make_time (time)
  491.      int time;
  492. {
  493.   return Fcons (make_number (time >> 16),
  494.         Fcons (make_number (time & 0177777), Qnil));
  495. }
  496.  
  497. DEFUN ("file-attributes", Ffile_attributes, Sfile_attributes, 1, 1, 0,
  498.   "Return a list of attributes of file FILENAME.\n\
  499. Value is nil if specified file cannot be opened.\n\
  500. Otherwise, list elements are:\n\
  501.  0. t for directory, string (name linked to) for symbolic link, or nil.\n\
  502.  1. Number of links to file.\n\
  503.  2. File uid.\n\
  504.  3. File gid.\n\
  505.  4. Last access time, as a list of two integers.\n\
  506.   First integer has high-order 16 bits of time, second has low 16 bits.\n\
  507.  5. Last modification time, likewise.\n\
  508.  6. Last status change time, likewise.\n\
  509.  7. Size in bytes (-1, if number is out of range).\n\
  510.  8. File modes, as a string of ten letters or dashes as in ls -l.\n\
  511.  9. t iff file's gid would change if file were deleted and recreated.\n\
  512. 10. inode number.\n\
  513. 11. Device number.\n\
  514. \n\
  515. If file does not exist, returns nil.")
  516.   (filename)
  517.      Lisp_Object filename;
  518. {
  519.   Lisp_Object values[12];
  520. #ifdef BSD4_2
  521.   Lisp_Object dirname;
  522.   struct stat sdir;
  523. #endif
  524.   struct stat s;
  525.   char modes[10];
  526.   Lisp_Object handler;
  527.  
  528.   filename = Fexpand_file_name (filename, Qnil);
  529.  
  530.   /* If the file name has special constructs in it,
  531.      call the corresponding file handler.  */
  532.   handler = Ffind_file_name_handler (filename);
  533.   if (!NILP (handler))
  534.     return call2 (handler, Qfile_attributes, filename);
  535.  
  536.   if (lstat (XSTRING (filename)->data, &s) < 0)
  537.     return Qnil;
  538.  
  539.   switch (s.st_mode & S_IFMT)
  540.     {
  541.     default:
  542.       values[0] = Qnil; break;
  543.     case S_IFDIR:
  544.       values[0] = Qt; break;
  545. #ifdef S_IFLNK
  546.     case S_IFLNK:
  547.       values[0] = Ffile_symlink_p (filename); break;
  548. #endif
  549.     }
  550.   values[1] = make_number (s.st_nlink);
  551.   values[2] = make_number (s.st_uid);
  552.   values[3] = make_number (s.st_gid);
  553.   values[4] = make_time (s.st_atime);
  554.   values[5] = make_time (s.st_mtime);
  555.   values[6] = make_time (s.st_ctime);
  556.   values[7] = make_number (s.st_size);
  557.   /* If the size is out of range, give back -1.  */
  558.   if (XINT (values[7]) != s.st_size)
  559.     XSETINT (values[7], -1);
  560.   filemodestring (&s, modes);
  561.   values[8] = make_string (modes, 10);
  562. #ifdef BSD4_3 /* Gross kludge to avoid lack of "#if defined(...)" in VMS */
  563. #define BSD4_2 /* A new meaning to the term `backwards compatibility' */
  564. #endif
  565. #ifdef BSD4_2            /* file gid will be dir gid */
  566.   dirname = Ffile_name_directory (filename);
  567.   if (! NILP (dirname) && stat (XSTRING (dirname)->data, &sdir) == 0)
  568.     values[9] = (sdir.st_gid != s.st_gid) ? Qt : Qnil;
  569.   else                    /* if we can't tell, assume worst */
  570.     values[9] = Qt;
  571. #else                    /* file gid will be egid */
  572. #ifdef WINDOWSNT
  573.   /*
  574.    * It should be noted that most of these values for nt are meaningless at
  575.    * the moment...  they should all do something that "makes sense".
  576.    */
  577.   values[9] = Qnil;
  578. #else /* !WINDOWSNT */
  579.   values[9] = (s.st_gid != getegid ()) ? Qt : Qnil;
  580. #endif /* !WINDOWSNT */
  581. #endif    /* BSD4_2 (or BSD4_3) */
  582. #ifdef BSD4_3
  583. #undef BSD4_2 /* ok, you can look again without throwing up */
  584. #endif
  585. #ifdef WINDOWSNT
  586. #ifdef BLAH_X86_
  587.   values[10] = make_number (s.st_ino);
  588.   values[11] = make_number (s.st_dev);
  589. #else
  590.   /*
  591.    * File uids on NT are found using a handle to a file, which
  592.    * implies that it has been opened.  Since we want to be able
  593.    * to stat an arbitrary file, we must open it, get the info,
  594.    * and then close it.
  595.    *
  596.    * Also, NT file uids are 64-bits.  This is a problem.
  597.    */
  598. {
  599.     HANDLE handle;
  600.     BOOL result;
  601.     BY_HANDLE_FILE_INFORMATION info;
  602.  
  603.     /*
  604.      * FIXME:  It shouldn't be opened without READ access, but NT on x86
  605.      * doesn't allow GetFileInfo in that case (NT on mips does).
  606.      */
  607.     handle = CreateFile(XSTRING(filename)->data,
  608.             GENERIC_READ,
  609.             FILE_SHARE_READ | FILE_SHARE_WRITE,
  610.             NULL,
  611.             OPEN_EXISTING,
  612.             FILE_ATTRIBUTE_NORMAL,
  613.             NULL);
  614.     if (handle == INVALID_HANDLE_VALUE) {
  615.     return Qnil;
  616.     }
  617.  
  618.     result = GetFileInformationByHandle(handle, &info);
  619.     CloseHandle(handle);
  620.     if (!result) {
  621.     return Qnil;
  622.     }
  623.  
  624.     values[10] = make_number(info.nFileIndexLow);    /* use the low value */
  625.     values[11] = make_number(info.dwVolumeSerialNumber);
  626. }
  627. #endif
  628. #else  /* WINDOWSNT */
  629.   values[10] = make_number (s.st_ino);
  630.   values[11] = make_number (s.st_dev);
  631. #endif /* WINDOWSNT */
  632.   return Flist (sizeof(values) / sizeof(values[0]), values);
  633. }
  634.  
  635. _VOID_
  636. syms_of_dired ()
  637. {
  638.   Qdirectory_files = intern ("directory-files");
  639.   Qfile_name_completion = intern ("file-name-completion");
  640.   Qfile_name_all_completions = intern ("file-name-all-completions");
  641.   Qfile_attributes = intern ("file-attributes");
  642.  
  643.   defsubr (&Sdirectory_files);
  644.   defsubr (&Sfile_name_completion);
  645. #ifdef VMS
  646.   defsubr (&Sfile_name_all_versions);
  647.   defsubr (&Sfile_version_limit);
  648. #endif /* VMS */
  649.   defsubr (&Sfile_name_all_completions);
  650.   defsubr (&Sfile_attributes);
  651.  
  652. #ifdef VMS
  653.   Qcompletion_ignore_case = intern ("completion-ignore-case");
  654.   staticpro (&Qcompletion_ignore_case);
  655. #endif /* VMS */
  656.  
  657.   DEFVAR_LISP ("completion-ignored-extensions", &Vcompletion_ignored_extensions,
  658.     "*Completion ignores filenames ending in any string in this list.\n\
  659. This variable does not affect lists of possible completions,\n\
  660. but does affect the commands that actually do completions.");
  661.   Vcompletion_ignored_extensions = Qnil;
  662. }
  663.